﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BL
{
    partial class tArticleStock
    {
        private static dbDataContext db;

        public static dbDataContext Db
        {
            get
            {
                if (db == null)
                {
                    db = new dbDataContext();
                }
                return db;
            }
        }


        internal static void SaveMessage(string[] message)
        {

            var update = db.tArticleStocks.SingleOrDefault(tas => tas.stockId == int.Parse(message[1])
                         && tas.stockPositionId == int.Parse(message[2])
                         && tas.articleId == int.Parse(message[3])
                         && tas.sortId == int.Parse(message[4]));

            if (update.deleted == true)
            {
                throw new NotImplementedException();
            }
            else
            {


                update.stockBalance =+ int.Parse(message[5]);

                Db.SubmitChanges();
            }
        }
    }
}
